﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Algemeen : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            FillDropDownListGroepen();
        }
    }

    private void FillDropDownListGroepen()
    {
        DropDownListGroepen.DataSource = SqlDataSourceGroepen;
        DropDownListGroepen.DataTextField = "groep";
        DropDownListGroepen.DataValueField = "idVanToepassingOp";
        DropDownListGroepen.DataBind();
        DropDownListGroepen.Items.Insert(0, new ListItem("--Selecteer een Groep--", "0"));
    }

    protected void CheckBox2_CheckedChanged(object sender, EventArgs e)
    {
        Calendar1.Visible = ((CheckBox)sender).Checked;
        Calendar2.Visible = ((CheckBox) sender).Checked;
    }
  
    protected void Button2_Click(object sender, EventArgs e)
    {
        ListBox2.Items.Add(ListBox1.SelectedItem);
        ListBox1.Items.Remove(ListBox1.SelectedItem);
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        ListBox1.Items.Add(ListBox2.SelectedItem);
        ListBox2.Items.Remove(ListBox2.SelectedItem);
    }
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
     

        if (((DropDownList)sender).SelectedIndex == 2)
        {
            DropDownListFilter.DataSource = SqlDataSourceFilter;
            DropDownListFilter.DataTextField = "COLUMN_NAME";
            DropDownListFilter.DataValueField = "COLUMN_NAME";
            DropDownListFilter.DataBind();
            DropDownListFilter.Items.Insert(0, new ListItem("--Selecteer een Eigenschap--", "0"));
            ListBox1.DataSource = SqlDataSourceKlanten;
            ListBox1.DataTextField = "familienaam";
        }
        if (((DropDownList)sender).SelectedIndex == 3)
        {
            DropDownListFilter.DataSource = SqlDataSourceFilter;
            DropDownListFilter.DataTextField = "COLUMN_NAME";
            DropDownListFilter.DataValueField = "COLUMN_NAME";
            DropDownListFilter.DataBind();
            DropDownListFilter.Items.Insert(0, new ListItem("--Selecteer een Eigenschap--", "0"));
            ListBox1.DataSource = SqlDataSourceKlantenGroepen;
            ListBox1.DataTextField = "naam";
        }
        
        ListBox1.DataBind();
    }
    protected void DropDownListFilter_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void CheckBox3_CheckedChanged(object sender, EventArgs e)
    {
        bool check=((CheckBox) sender).Checked;
        TextBoxVergelijking.Visible = check;
        DropDownListFilter.Visible = check;
        DropDownListVgling.Visible = check;
    }
   
}
